-
Notifications
You must be signed in to change notification settings - Fork 95
Dynamically type getters and hassers for parameters #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I love this! This is well thought out and I found only a single minor problem :) I wish that more people like you contributed to PHPStan :) Thank you.
|
Alright: a586e24 I'm gonna squash this and release it :) |
|
Thank you! |
|
@Kocal 👍 👏 Just tested your branch on our project and it found the following:
|
|
Enjoy it in phpstan-symfony 0.12.29 :) |
|
Nice! :D |
Hi!
This is a proposal for #127.
I've re-used the same logic for services:
ParameterMapwhich contains all parametersDynamic return types have been implemented for:
ParameterBagInterface#getandParameterBagInterface#hasContainerInterface#getParameterandContainerInterface#hasParameterAbstractController#getParameterandController#getParameterHowever, I'm not able to do the same forAbstractController#getParameterandController#getParameterwhen using$this->getParameter('...')inside aAbstractControllerandController. It always use the return type fromAbstractController#getParameter. Is this a limitation from PHPStan or I did something wrong @ondrejmirtes?Also in Symfony 4.0 (lowest deps), there is no methodAbstractController#getParameter()and it make the tests failing. What is the best way to support lowest and highest Symfony version in tests and extension? What about using Symfony 4.4 as minimal requirements and droppingControllerusage? This is the only 4.x supported version right now.EDIT: Nevermind I fixed in c2d3f79 by using 4.4 as lowest version for
symfony/framework-bundle, and manually create the default type if a parameter does not exist.